import React, {Component, PropTypes} from 'react';
import {Router, Route, IndexRoute, browserHistory, hashHistory } from 'react-router';


import Todo from '../views/todo/view';
import Home from '../views/home/view';
import Weibo from '../views/weibo/view';
import EditAddress from '../views/LCApp/Address/editAddress';
import AddAddress from '../views/LCApp/Address/addAddress';
import ReceiptA from '../views/LCApp/Address/receiptAddress';
/**
 * (路由根目录组件，显示当前符合条件的组件)
 *
 * @class Roots
 * @extends {Component}
 */
class Roots extends Component {
    render() {
        return (
            <div id="App">{this.props.children}</div>
        );
    }
}

class AddressRoot extends Component {
    render() {
        return (
            <div id="Address">{this.props.children}</div>
        );
    }
}

const RouteConfig = (
    <Router history={hashHistory}>
        <Route path="/" component={Roots}>
            <IndexRoute component={Home}/>
            <Route path="/todo" component={Todo} />
            <Route path="/weiBo" component={Weibo} />
            <Route path="/address" component={AddressRoot} >
                <IndexRoute component={ReceiptA}/>
                <Route path="/address/add" component={AddAddress} />
                <Route path="/address/edit" component={EditAddress} />
            </Route>
        </Route>
    </Router>
);

export default RouteConfig;